package com.frx.datastruct.chaptersix;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by xurenfeng on 2019/3/1.
 */
public class MainTest {

    public static void main(String[] args){
        BST<Integer> bst = new BST<>();

        Random random = new Random();
        // 向二叉树中随机添加1000个元素
        int n = 1000;

        for (int i=0;i<n;i++){
            bst.add(random.nextInt(10000));
        }
        ArrayList<Integer> nums = new ArrayList<>();
        while (!bst.isEmpty()){
            nums.add(bst.removeMin());
        }
        System.out.println(nums.size());
        System.out.println(nums);
        for (int i = 1;i<nums.size();i++){
            if (nums.get(i-1)>nums.get(i)){
                throw new IllegalArgumentException("Error!");
            }
        }
        System.out.println("removeMin test completed");

    }
}
